package br.ufpi.model;

import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

@Entity
@NamedQueries({
	@NamedQuery(name = "User.login", query = "SELECT u FROM User u WHERE (u.login.email= :login AND u.login.password= :password) OR (u.login.nickName= :login AND u.login.password= :password)"),
	@NamedQuery(name = "User.findByConfirmationEmail", query = "SELECT u FROM User u WHERE u.login.tokenActive= :confirmationEmail"),
	@NamedQuery(name = "User.findByEmail", query = "SELECT u FROM User u WHERE u.login.email= :email"),
	@NamedQuery(name = "User.findById", query = "SELECT u FROM User u WHERE u.id= :id"),
	@NamedQuery(name = "User.findByNickName", query = "SELECT u FROM User u WHERE u.login.nickName= :nickName"),
	@NamedQuery(name = "User.findTokenActive", query = "SELECT u FROM User u WHERE u.login.tokenActive= :tokenActive"),
	@NamedQuery(name = "User.findByLogin", query = "SELECT u FROM User u WHERE u.login.nickName= :login OR u.login.email= :login"),
})

public class User {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	@Embedded
	private Login login;
	private String telefone;
	private String name;
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Login getLogin() {
		return login;
	}
	public void setLogin(Login login) {
		this.login = login;
	}
	public String getTelefone() {
		return telefone;
	}
	public void setTelefone(String telefone) {
		this.telefone = telefone;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
}
